
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>success</title>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <!-- 2. jQuery导入，建议使用1.9以上的版本 -->
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <!-- 3. 导入bootstrap的js文件 -->
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <style>
        tr:nth-child(odd) {
            background-color: #fcf8e3;
        }
        #link1,#link2,#link3,#link4:hover {text-decoration: none;}
    </style>
</head>
<body>
<div class="page-header" >
    <h2>
        <small style="margin-left: 36px;">流动人口管理系统</small>
        <a   id="link1" href="${pageContext.request.contextPath}/firstPage" style="margin-left: 800px;font-size: 15px; color: #888888">首页</a>
        <a  id="link2" href="${pageContext.request.contextPath}/child" style="margin-left: 20px;font-size: 15px; color: #888888">子女信息</a>
        <a id="link3" href="${pageContext.request.contextPath}/externalPopulation" style="margin-left: 20px;font-size: 15px; color: #888888">流动人口</a>
        <a id="link4" href="${pageContext.request.contextPath}/residentialPass"  style="margin-left: 20px;font-size: 15px; color: #888888">登记信息</a>
    </h2>
</div>

<div class="container-fluid">
    <div class="row-fluid">
        <div class="span12">
            <div class="tabbable" id="tabs-439757">
                <ul class="nav nav-tabs" style="width: 1300px; margin-left: 60px; margin-top: 40px;">
                    <li class="active">
                        <a href="#panel-370484" data-toggle="tab" >未在本市就学</a>
                    </li>
                    <li >
                        <a href="#panel-176774" data-toggle="tab">本市就学</a>
                    </li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="panel-370484" style="margin-left: 56px;">
                        <p >
                        <ul class="breadcrumb" style=" margin-left: 40px; background-color: rgb(255, 255, 255);">
                            <li>
                                <a href="/firstPage">主页</a>
                                <span class="divider"> »</span>
                            </li>
                            <li class="active">
                                子女信息
                                <span class="divider"> »</span>
                            </li>
                        </ul>
                        <div  style="margin-right: 160px">
                                <div class="container">
                                    <table  id="tab" class="table table-bordered table-hover" style="overflow:hidden;border: 2px #000;border-radius: 3px">
                                    <thead>
                                    <tr class="info">
                                        <td>姓名</td>
                                        <td>生日</td>
                                        <td>父母身份证号</td>
                                        <td>与户主关系</td>
                                        <td>是否接种疫苗</td>
                                        <td>操作</td>
                                    </tr>
                                    </thead>

                                    <c:forEach items="${childList}" var="child">
                                        <tr>
                                            <td>${child.name}</td>
                                            <td>${child.birthday}</td>
                                            <td>${child.ID_number}</td>
                                            <td>${child.kinship}</td>
                                            <td>${child.vaccine}</td>
                                            <td>
                                                <button id ="update"  class="btn btn-warning" style="margin-right: 10px">修改</button>
                                                <button id="delete" class="btn btn-danger">删除</button>
                                            </td>
                                        </tr>
                                    </c:forEach>

                                </table>
                                </div>
                                <a href="${pageContext.request.contextPath}/child/addChildPage"  style="margin-left: 1107px">
                                    <button class="btn btn-info" type="button">添加子女信息</button>
                                </a>
                            </div>
                        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                            <div class="modal-dialog" role="document">
                                <form action="${pageContext.request.contextPath}/child/updateChild" method="post">
                                <div class="modal-content">
                                        <div class="modal-header">
                                            <h4 class="modal-title" id="myModalLabel">修改子女信息</h4>
                                        </div>
                                        <div class="modal-body">

                                            <div class="form-group">
                                                <label for="name">姓名：</label>
                                                <input type="text" class="form-control" id="name" name="name"></br>
                                            </div>
                                            <div class="form-group">
                                                <label for="birthday">生日：</label>
                                                <input type="Date" class="form-control" name="birthday" id="birthday"></br>
                                            </div>
                                            <div class="form-group">
                                                <label for="ID_number">身份证号：</label>
                                                <input type="text" class="form-control" id="ID_number" name="ID_number" ></br>
                                            </div>
                                            <div class="form-group">
                                                <label for="kinship">亲属关系：</label>
                                                <input type="text" class="form-control" id="kinship" name="kinship"></br>
                                            </div>
                                            <div class="form-group">
                                                <label for="vaccine">是否接种疫苗：</label>
                                                <input type="text" class="form-control" id="vaccine" name="vaccine"></br>
                                            </div>

                                        </div>
                                        <div class="modal-footer">
                                            <button type="button" class="btn btn-default" data-dismiss="modal"><span
                                                    class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
                                            <input type="submit" class="btn btn-primary" value="保存"  >
                                        </div>

                                </div>
                                </form>
                            </div>
                        </div>
                        <div class="modal fade" id="deleteChild" tabindex="-1" role="dialog" >
                            <div class="modal-dialog" role="document">
                                <form action="${pageContext.request.contextPath}/child/deleteChild" method="post">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                        <h4 class="modal-title" >删除子女信息</h4>
                                    </div>
                                    <div class="modal-body">
                                        <h3>
                                            是否删除<input type="text"  id="deleteName" style= "background-color:transparent;border:0;" disabled  />
                                            <input type="text"  id="ID" name="ID"  readonly style="display:none;" />
                                        </h3>
                                    </div>
                                    <div class="modal-footer">
                                        <button type="button" class="btn btn-default" data-dismiss="modal">
                                            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>关闭</button>
                                        <input type="submit" class="btn btn-primary" value="保存"  >
                                    </div>
                                </div>
                                </form>
                            </div>
                        </div>
                    </p>

                </div>
                    <div class="tab-pane" id="panel-176774" style="margin-left: 56px;">
                        <iframe class="iframeurl" frameborder="0" style=" margin-top:9px;height: 100%;width: 100%" src="/student"  seamless></iframe>
                    </div>
            </div>
        </div>
    </div>
</div>
</div>

</body>
</html>
<script>
    //注册新增按钮的事件
    $(function() {
        $("#tab").on("click", "#update", function(event) {
            $('#myModal').modal();
            $("#name").val($(this).closest("tr").find("td").eq(0).text());
            $("#birthday").val($(this).closest("tr").find("td").eq(1).text());
            $("#ID_number").val($(this).closest("tr").find("td").eq(2).text());
            $("#kinship").val($(this).closest("tr").find("td").eq(3).text());
            $("#vaccine").val($(this).closest("tr").find("td").eq(4).text());
        });
        $("#tab").on("click", "#delete", function(event) {
            $('#deleteChild').modal();
            $("#deleteName").val($(this).closest("tr").find("td").eq(0).text());
            $("#ID").val($(this).closest("tr").find("td").eq(2).text());
        });
    });
    var url=window.location.href;
    var type=url.split('#')[1];
    console.log(url)
    if(type=="student"){
        $('#tabs-439757 a[href="#panel-176774"]').tab('show')
    }
</script>
